Fixed issues pointed out by Ms2ger
Cleaned up & updated tests