modularized stuff a bit