Fixed some stuff, added functionality