HJW Added support for all sides and positions

Yet to be tested, but the program is now able to go for any position
coming from any side