Converted to work with knockoutjs