Moved define script and made battery work better with OS X