Refactored for compadibility with resizeable div directive