Some fixes to the code, including portlet

Adding the port let code and some fixes provided by Raghu