fixed some bugs introduced from refactoring, updated some parameter names to better reflect their meaning