better exception handling
better flow control
more blank lines for readability