Added sanity checks and echo messages