Code fixes, should be more readable now