cleaned up my code a bit