misc code written in c