Debugged file declaration stage and added some additional unit tests