Bugfixes and Code Cleanup

Fixed bug with generating sql queries - getWhereAndSortBy will guarantee
to always trail with exactly one comma.
Also fixed a bug that was removing almost the whole where clause rather
than just the ending "and".
Fixed a bug that let the user press the remove button when no elements
were selected.
Removed all print statements.