Modified the main function to get observations

Added some helper functions as well.