restructure dependency loading and improve message system