Fixed some bugs - still really stupidly slow