refactored.. new error - TypeError: Property '$' of object #<Object> is not a