Edited direction.js