Some refactoring, more to come
Fixed a bug with points and values