Got it working, the basics
Bug fix (more of a hack really)