Upgraded to support custom entry point.