Fixed some bugs and moved some files