Removed mode parameter from data commands

Also fixed some bugs and added more comments