Implemented fetchAll

+ Fixed jshint issues
+ Refactored $sync