Refactory, just used brightstardb for now