Dynamic choose of master+track

Added comments in the code!