cleaned up code.

Changed main and took a step back for the sake of cleaner code.