Cleaned up script to conform more towards ruby style guide