Still fixing some bugs
A version that somehow works