Made it actually work ok

Read the code and copy it if you don't understand it I dont really
understand it but I do a bit