learning curve code implemented, looks like it is working
modified log to make it base 2 instead of base e