more sensible indentation, some comments, added Jade style switch statements