implemented major functionality