Fixed a few problems, now works