Edited for MVC format + improvments.