Improved debugging. Renamed entry point function