added more things from ENIGMA and removed useless code