restuctured a bit