[edit] better code