Needs overhall! More error checking!