fix flag functionality and add commenting