Cleanued up code a little