Fixed some bugs and added comments to NGS-app