added directions logic