New functionality and code refactoring done

Script now takes care of transfered calls and is refactored (hopefully
more readable).