Some fixes to the code

Adding the portlet code and some fixes provided by Raghu