Lots of unnecessary code here. Have to cleanup.