Added embedded server for es and cleanup code