better logic in scripts