Cleaned up code a bit
Merged conflicts