refactored alphabeta
slightly reverted due to weird performance
slightly more refactored