A lot of debugging and just fiddling