XP code mna/vgr
getting ready for flags
updated code to angular 1.3