scratch that last commit, this is the working code