Created drawLine function to remove repeative actions.