Make rake task and server more generic