Cleaned some code. Added minor fixes.