organized the code better