Fixed something, added memory clearing