Modified to use with ROS and non ROS environments