Refactored into using the server implementation rather than using jQuery directly!
Combined!