finished basic implementation. debugging