updated main to follow c-code