refactor out shared components
minor bugfixes to match alpcbuggery changes