extracted sources from JMegahal-library