Cleaned up and moved some code around.
Merge branch 'master' of https://github.com/jahales/BIRD