Added path stack and related functions.