Fixed Matthew's stuff.
Merged with Matthew's changes and fixed up few stuff.