version 1: compiles and partially works, added console messages (logs) to track execution progress