mostly working
fixed bugs