Cleaned up the code.
Fixed merge.