factor out some constancts. use [] instead of array() in some places