code for 2048 - a little buggy