base functionality implementation - many bugs