new styling, removed some DRY code