fixed bugs, needs looking over