Added support for platform. Fixed up some code.