added more code to support classes