a lot of modified code to make it docker suitable