refactoring with __init__