Fixed some function calling stuff
Ray with margin