Fixed indentation, removed printlns, moved error handling into seperate method