Various changes:
- Fixed potential bug
- Cleaned whitespace/indentation pointed out by rubenwardy