Added level editor and fixed several bugs.