Bugfixing, Testing

Fixed some compiler bug; a few logical bugs; did testing - result: took
too long; did some optimisation but didn't help much