Small Changes. use if isHorizontal.. isToptoBottom...