updates for FreeBSD, made it a bit more modular