extracted some abstractions and performed a bit incapsulation