Organized the code better