First working commit, but ugly code :(