Added basic linking support
Fixed an off by one