Added significant code for end-to-end prototype