implemented 3 term magic number