Started read_current_flags function and review coding style (using more exceptions)