Removed some JSHint warnings and added testing for chainability