new working code sparse and lots of chaneges, next commits message will be better
Forgot to commit lots of things