added proper test set, bug fixes