Cleaned up unneeded optionals and type conversations.

This cleans up the code quite a bit it and makes it more readable/understandable as the unneeded stuff might confuse people new to Swift.