A port of John Resig Class Implementation