Change checks to empty() and movement of try statements
Signed-off-by: Luke Tainton <luke@tainton.uk>