Got a lot of stuff working
Some helper functions