New logic for new/edit model. Few fixes for setting env. flag. Static
pages fix.