Making script more generic and readable.