Changed file structure and cleaned up code a bit.