Improve JS class pattern implementation.