Reverted to use class with class object to avoid some problems(completion, binary compatibility etc) and added workaround to avoid wrong code generation.